﻿Imports ComponentPro.Net.Mail
Imports ComponentPro.Net

Namespace LightSwitchApplication
    Public Class Email
        Public Shared Sub Email()
            Dim client As New Smtp()

            ' Connect to the server. 
            'client.Connect("smtp.gmail.com")
            ComponentPro.Security.SecuritySettings.MediumTrust = True
            ' Or you can specify the SMTP port with 
            client.Connect("smtp.gmail.com", 465, SecurityMode.Implicit)

            ' Login to the server. 
            client.Authenticate("onlyouknowho@gmail.com", "mey291375")

            ' ... 

            ' Create a new mail message. 
            Dim msg As New MailMessage()
            msg.Subject = "Test Subject"
            msg.BodyText = "Name"
            msg.From = "onlyouknowho@gmail.com"
            msg.To = "frank.h.meyers@gmail.com"

            ' Send the message. 
            client.Send(msg)

            ' ... 

            Console.WriteLine("Message sent successfully.")

            ' Disconnect. 
            client.Disconnect()
        End Sub

    End Class
End Namespace

